var t, e = (t = require("@vant/weapp/toast/toast")) && t.__esModule ? t : {
    default: t
};

getApp();

var a = require("../../utils/api"), n = require("../../utils/request"), o = (require("../../utils/check"), 
require("../../utils/storage")), r = require("../../utils/config");

Page({
    data: {
        themeColor: getApp().globalData.themeColor,
        reservationList: [],
        reservationOrderImageUrl: "",
        checkedReservationOrder: {},
        pageIndex: 1,
        pageSize: 5,
        title: "点击加载更多"
    },
    onLoad: function() {},
    onShow: function() {
        this.setData({
            reservationOrderImageUrl: r.resourceRoot + "tjyydd.png?v=3"
        }), this.getReservationOrder(!0);
    },
    getReservationOrder: function(t) {
        var o = this;
        wx.showLoading({
            title: "正在加载中...",
            mask: !0
        }), n.request(n.HttpMethod.GET, a.apiRoute.getReservationOrderByPage + "?pageSize=" + this.data.pageSize + "&pageIndex=" + this.data.pageIndex, {}).then(function(e) {
            if ("20000" == e.code) {
                if (wx.hideLoading(), null != e.data && e.data.length > 0) {
                    var a = t ? [] : o.data.reservationList;
                    e.data.forEach(function(t) {
                        a.map(function(t) {
                            return t.id;
                        }).indexOf(t.id) <= -1 && a.push(t);
                    }), o.setData({
                        reservationList: a
                    });
                }
                (null == e.data || e.data.length <= 0) && (o.setData({
                    title: "我是有底线的"
                }), wx.showToast({
                    title: "已无更多数据",
                    duration: 3e3,
                    mask: !1,
                    icon: "none"
                }));
            }
        }).catch(function(t) {
            wx.hideLoading(), console.log(t), (0, e.default)({
                message: "获取可打印胶片信息异常",
                duration: 5e3
            });
        });
    },
    getReservationOrderDetail: function(t) {
        if ("N" == t.currentTarget.dataset.content.status) this.setData({
            showDetailPopup: !0,
            checkedReservationOrder: t.target.dataset.content
        }); else {
            var e = this;
            e.setData({
                loading: !0
            }), r.getH5ResvDetailUrl().then(function(r) {
                var i = o.getStorageSync(o.storageKey.uid), s = t.target.dataset.content.checkCardNo, c = !([ "CRS_BulkLd", "WEB_BulkResv", "ZJ_OutSideInPut", "PQ_Bulkld", "PQ_BulkLd", "KA_Family", "KA_WEB_BULK_RESV" ].indexOf(t.target.dataset.content.sourceValue) >= 0), d = t.target.dataset.content.resvPid || "", u = t.target.dataset.content.vip || "0", l = t.target.dataset.content.companyCode, g = t.target.dataset.content.ldno, p = i || "", h = "cardNo=".concat(s, "&bindCard=").concat(c, "&isVIP=").concat(u, "&resvPid=").concat(d, "&companyID=").concat(l, "&ldNo=").concat(g, "&showButton=true&isVCard=").concat(!0, "&source=wechatAppletNew&operator=").concat(p), v = o.getStorageSync(o.storageKey.locationInfo);
                null != v && null != v && "" != v && (h += "&pointY=".concat(v.latitude, "&pointX=").concat(v.longitude));
                var f = r;
                n.request(n.HttpMethod.POST, a.apiRoute.encodeResvUrl, {
                    urlpara: h
                }).then(function(t) {
                    var a = "".concat(f, "&accesskey=").concat(t.url);
                    wx.navigateTo({
                        url: "/pages/webview/webview?h5=".concat(encodeURIComponent(a)),
                        success: function() {
                            e.setData({
                                loading: !1
                            });
                        }
                    });
                });
            });
        }
    },
    onPopupClose: function() {
        this.setData({
            showDetailPopup: !1
        });
    },
    addMore: function() {
        var t = this.data.pageIndex + 1;
        this.setData({
            pageIndex: t
        }), this.getReservationOrder(!1);
    }
});